<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    async function Fn() {
        let p = new Promise((resolve, reject) => {
            reject('no')
        })
        // 1.await 右侧为Promise对象
        // let res = await p
        // console.log(res);

        // 2.await 右侧不是Promise类型
        // let res2 = await 10
        // console.log(res2);

        // 3.await 右侧是Promise并且是一个失败的状态 需要用try catch来捕获错误
        try {
            let res3 = await p
        } catch (error) {
            console.log(error);
        }
    }
    Fn()
</script>

</html>